package xyz.bali16.module.netdisk.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(BaseController.API+"sys")
public class SystemController extends NetdiskBaseController {

    //Logger logger = LogUtils.getInstance(SystemController.class);



//
//    @GetMapping("/upload")
//    public String toUploadPage(Integer fId, String fName, Map<String, Object> map) {
//        //包含的子文件夹
//        List<FileFolder> folders = null;
//        //当前文件夹信息
//        FileFolder nowFolder = null;
//        //当前文件夹的相对路径
//        List<FileFolder> location = new ArrayList<>();
//        if (fId == null || fId <= 0) {
//            //代表当前为根目录
//            fId = 0;
//            folders = fileFolderService.getRootFoldersByFileStorageId(sysUser.getFileStorageId());
//            nowFolder = FileFolder.builder().fileFolderId(fId).build();
//            location.add(nowFolder);
//        } else {
//            //当前为具体目录
//            folders = fileFolderService.getFileFolderByParentFolderId(fId);
//            nowFolder = fileFolderService.getFileFolderByFileFolderId(fId);
//            //遍历查询当前目录
//            FileFolder temp = nowFolder;
//            while (temp.getParentFolderId() != 0) {
//                temp = fileFolderService.getFileFolderByFileFolderId(temp.getParentFolderId());
//                location.add(temp);
//            }
//        }
//        Collections.reverse(location);
//        //获得统计信息
//        FileStorageStatistics statistics = uploadFileService.getCountStatistics(sysUser.getFileStorageId());
//        map.put("statistics", statistics);
//        map.put("folders", folders);
//        map.put("nowFolder", nowFolder);
//        map.put("location", location);
//        logger.info("网盘页面域中的数据:" + map);
//        return "u-admin/upload";
//    }
//
//    @GetMapping("/doc-files")
//    public String toDocFilePage( Map<String, Object> map) {
//        List<UploadFile> files = uploadFileService.getFilesByType(sysUser.getFileStorageId(),1);
//        //获得统计信息
//        FileStorageStatistics statistics = uploadFileService.getCountStatistics(sysUser.getFileStorageId());
//        map.put("statistics", statistics);
//        map.put("files", files);
//        map.put("permission", fileStorageService.getFileStorageByUserId(sysUser.getUserId()).getPermission());
//        return "u-admin/doc-files";
//    }
//
//    @GetMapping("/image-files")
//    public String toImageFilePage( Map<String, Object> map) {
//        List<UploadFile> files = uploadFileService.getFilesByType(sysUser.getFileStorageId(),2);
//        //获得统计信息
//        FileStorageStatistics statistics = uploadFileService.getCountStatistics(sysUser.getFileStorageId());
//        map.put("statistics", statistics);
//        map.put("files", files);
//        map.put("permission", fileStorageService.getFileStorageByUserId(sysUser.getUserId()).getPermission());
//        return "u-admin/image-files";
//    }
//
//    @GetMapping("/video-files")
//    public String toVideoFilePage( Map<String, Object> map) {
//        List<UploadFile> files = uploadFileService.getFilesByType(sysUser.getFileStorageId(),3);
//        //获得统计信息
//        FileStorageStatistics statistics = uploadFileService.getCountStatistics(sysUser.getFileStorageId());
//        map.put("statistics", statistics);
//        map.put("files", files);
//        map.put("permission", fileStorageService.getFileStorageByUserId(sysUser.getUserId()).getPermission());
//        return "u-admin/video-files";
//    }
//
//    @GetMapping("/music-files")
//    public String toMusicFilePage( Map<String, Object> map) {
//        List<UploadFile> files = uploadFileService.getFilesByType(sysUser.getFileStorageId(),4);
//        //获得统计信息
//        FileStorageStatistics statistics = uploadFileService.getCountStatistics(sysUser.getFileStorageId());
//        map.put("statistics", statistics);
//        map.put("files", files);
//        map.put("permission", fileStorageService.getFileStorageByUserId(sysUser.getUserId()).getPermission());
//        return "u-admin/music-files";
//    }
//
//    @GetMapping("/other-files")
//    public String toOtherFilePage( Map<String, Object> map) {
//        List<UploadFile> files = uploadFileService.getFilesByType(sysUser.getFileStorageId(),5);
//        //获得统计信息
//        FileStorageStatistics statistics = uploadFileService.getCountStatistics(sysUser.getFileStorageId());
//        map.put("statistics", statistics);
//        map.put("files", files);
//        map.put("permission", fileStorageService.getFileStorageByUserId(sysUser.getUserId()).getPermission());
//        return "u-admin/other-files";
//    }
//
//    @GetMapping("/index")
//    public String index(Map<String, Object> map) {
//        //获得统计信息
//        FileStorageStatistics statistics = uploadFileService.getCountStatistics(sysUser.getFileStorageId());
//        statistics.setFileStorage(fileStorageService.getFileStorageById(sysUser.getFileStorageId()));
//        map.put("statistics", statistics);
//        return "u-admin/index";
//    }
//
//
//    @GetMapping("/help")
//    public String helpPage(Map<String, Object> map) {
//        //获得统计信息
//        FileStorageStatistics statistics = uploadFileService.getCountStatistics(sysUser.getFileStorageId());
//        map.put("statistics", statistics);
//        return "u-admin/help";
//    }
}
